<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />









  <meta name="baidu-site-verification" content="Q7ugSRSO7V" />







  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="mongo,install," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="官网当然，最权威的还是官网官方wiki 安装 官网安装方式 安装之后可以将mongodb的bin目录增加到PATH目录中 例如mac：只需要brew install mongodb,然后将/usr/local/Cellar/mongodb/3.4.2/bin加入到path中即可启动 创建目录demo： /chimps/web_back/mongodb lldrwxr-xr-x   3 chimp">
<meta name="keywords" content="mongo,install">
<meta property="og:type" content="article">
<meta property="og:title" content="installAndHelp">
<meta property="og:url" content="http://yoursite.com/mongodb/installAndHelp/index.html">
<meta property="og:site_name" content="chimps">
<meta property="og:description" content="官网当然，最权威的还是官网官方wiki 安装 官网安装方式 安装之后可以将mongodb的bin目录增加到PATH目录中 例如mac：只需要brew install mongodb,然后将/usr/local/Cellar/mongodb/3.4.2/bin加入到path中即可启动 创建目录demo： /chimps/web_back/mongodb lldrwxr-xr-x   3 chimp">
<meta property="og:updated_time" content="2017-06-07T05:39:23.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="installAndHelp">
<meta name="twitter:description" content="官网当然，最权威的还是官网官方wiki 安装 官网安装方式 安装之后可以将mongodb的bin目录增加到PATH目录中 例如mac：只需要brew install mongodb,然后将/usr/local/Cellar/mongodb/3.4.2/bin加入到path中即可启动 创建目录demo： /chimps/web_back/mongodb lldrwxr-xr-x   3 chimp">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"hide","offset":12,"offset_float":0,"b2t":false,"scrollpercent":false},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":30},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/mongodb/installAndHelp/"/>





  <title> installAndHelp | chimps </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?dcb994042608bdb310eff950ba755ff1";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>










  
  
    
  

  <div class="container sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">chimps</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle"></p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
    </ul>
  

  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
    <link itemprop="mainEntityOfPage" href="http://yoursite.com/mongodb/installAndHelp/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="chimps">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="chimps">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                installAndHelp
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-04-17T22:53:16+08:00">
                2017-04-17
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/mongodb/" itemprop="url" rel="index">
                    <span itemprop="name">mongodb</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a class="cloud-tie-join-count" href="/mongodb/installAndHelp/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count join-count" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="官网"><a href="#官网" class="headerlink" title="官网"></a>官网</h1><p>当然，最权威的还是官网<br><a href="https://docs.mongodb.com" target="_blank" rel="external">官方wiki</a></p>
<h1 id="安装"><a href="#安装" class="headerlink" title="安装"></a>安装</h1><ul>
<li><a href="https://docs.mongodb.com/manual/administration/install-enterprise/" target="_blank" rel="external">官网安装方式</a></li>
<li>安装之后可以将mongodb的bin目录增加到PATH目录中</li>
<li>例如mac：只需要<code>brew install mongodb</code>,<br>然后将<code>/usr/local/Cellar/mongodb/3.4.2/bin</code>加入到path中即可<h1 id="启动"><a href="#启动" class="headerlink" title="启动"></a>启动</h1></li>
<li><p>创建目录<br>demo：</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">/chimps/web_back/mongodb ll</div><div class="line">drwxr-xr-x   3 chimp  wheel  102  3 21 14:01 conf</div><div class="line">drwxr-xr-x  20 chimp  wheel  680  3 21 14:32 data</div><div class="line">drwxr-xr-x   4 chimp  wheel  136  3 21 14:07 log</div></pre></td></tr></table></figure>
</li>
<li><p>增加conf文件<br>此时没有增加用户认证，生产环境肯定要加的</p>
<figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">/chimps/web_back/mongodb cat conf/mongod.conf</div><div class="line">port = 12345</div><div class="line">dbpath = data</div><div class="line">logpath = log/mongod.log</div><div class="line">fork = true</div></pre></td></tr></table></figure>
</li>
<li><p>运行<code>mongod -f /conf/mongod.conf</code><br>之前将/usr/local/Cellar/mongodb/3.4.2/bin加入到PATH中，mongod可执行文件就在此目录下</p>
</li>
<li>日志存放在<code>log/mongod.log</code>中<figure class="highlight plain"><table><tr><td class="code"><pre><div class="line">/chimps/web_back/mongodb tail -f log/mongod.log</div><div class="line">2017-03-21T14:07:03.850+0800 I -        [initandlisten] Detected data files in /chimps/web_back/mongodb/data created by the &apos;wiredTiger&apos; storage engine, so setting the active storage engine to &apos;wiredTiger&apos;.</div><div class="line">... ...</div></pre></td></tr></table></figure>
</li>
</ul>
<h1 id="连接"><a href="#连接" class="headerlink" title="连接"></a>连接</h1><h2 id="mongo-h"><a href="#mongo-h" class="headerlink" title="mongo -h"></a>mongo -h</h2><figure class="highlight shell"><table><tr><td class="code"><pre><div class="line">~ mongo -h</div><div class="line">MongoDB shell version v3.4.2</div><div class="line">usage: mongo [options] [db address] [file names (ending in .js)]    # 格式</div><div class="line">db address can be:</div><div class="line">  foo                   foo database on local machine</div><div class="line">  192.168.0.5/foo       foo database on 192.168.0.5 machine</div><div class="line">  192.168.0.5:9999/foo  foo database on 192.168.0.5 machine on port 9999</div><div class="line">Options:</div><div class="line">  --shell                             run the shell after executing files</div><div class="line">  --nodb                              don't connect to mongod on startup - no</div><div class="line">                                      'db address' arg expected</div><div class="line">  --norc                              will not run the ".mongorc.js" file on</div><div class="line">                                      start up</div><div class="line">  --quiet                             be less chatty</div><div class="line">  --port arg                          port to connect to</div><div class="line">  --host arg                          server to connect to</div><div class="line">  --eval arg                          evaluate javascript</div><div class="line">  -h [ --help ]                       show this usage information</div><div class="line">  --version                           show version information</div><div class="line">  --verbose                           increase verbosity</div><div class="line">  --ipv6                              enable IPv6 support (disabled by default)</div><div class="line">  --disableJavaScriptJIT              disable the Javascript Just In Time</div><div class="line">                                      compiler</div><div class="line">  --disableJavaScriptProtection       allow automatic JavaScript function</div><div class="line">                                      marshalling</div><div class="line">  --ssl                               use SSL for all connections</div><div class="line">  --sslCAFile arg                     Certificate Authority file for SSL</div><div class="line">  --sslPEMKeyFile arg                 PEM certificate/key file for SSL</div><div class="line">  --sslPEMKeyPassword arg             password for key in PEM file for SSL</div><div class="line">  --sslCRLFile arg                    Certificate Revocation List file for SSL</div><div class="line">  --sslAllowInvalidHostnames          allow connections to servers with</div><div class="line">                                      non-matching hostnames</div><div class="line">  --sslAllowInvalidCertificates       allow connections to servers with invalid</div><div class="line">                                      certificates</div><div class="line">  --sslFIPSMode                       activate FIPS 140-2 mode at startup</div><div class="line">  --networkMessageCompressors arg     Comma-separated list of compressors to</div><div class="line">                                      use for network messages</div><div class="line">  --jsHeapLimitMB arg                 set the js scope's heap size limit</div><div class="line"></div><div class="line">Authentication Options:</div><div class="line">  -u [ --username ] arg               username for authentication</div><div class="line">  -p [ --password ] arg               password for authentication</div><div class="line">  --authenticationDatabase arg        user source (defaults to dbname)</div><div class="line">  --authenticationMechanism arg       authentication mechanism</div><div class="line">  --gssapiServiceName arg (=mongodb)  Service name to use when authenticating</div><div class="line">                                      using GSSAPI/Kerberos</div><div class="line">  --gssapiHostName arg                Remote host name to use for purpose of</div><div class="line">                                      GSSAPI/Kerberos authentication</div><div class="line"></div><div class="line">file names: a list of files to run. files have to end in .js and will exit after unless --shell is specified</div></pre></td></tr></table></figure>
<ul>
<li>只需要：<code>mongo localhost:12345</code><h1 id="数据库操作"><a href="#数据库操作" class="headerlink" title="数据库操作"></a>数据库操作</h1></li>
<li><p><code>db.help()</code></p>
<figure class="highlight"><table><tr><td class="code"><pre><div class="line">&gt; db.help()</div><div class="line">DB methods:</div><div class="line">	db.adminCommand(nameOrDocument) - switches to 'admin' db, and runs command [ just calls db.runCommand(...) ]</div><div class="line">	db.auth(username, password)</div><div class="line">	db.cloneDatabase(fromhost)</div><div class="line">	db.commandHelp(name) returns the help for the command</div><div class="line">	db.copyDatabase(fromdb, todb, fromhost)</div><div class="line">	db.createCollection(name, &#123; size : ..., capped : ..., max : ... &#125; )</div><div class="line">	db.createView(name, viewOn, [ &#123; $operator: &#123;...&#125;&#125;, ... ], &#123; viewOptions &#125; )</div><div class="line">	db.createUser(userDocument)</div><div class="line">	db.currentOp() displays currently executing operations in the db</div><div class="line">	db.dropDatabase()</div><div class="line">	db.eval() - deprecated</div><div class="line">	db.fsyncLock() flush data to disk and lock server for backups</div><div class="line">	db.fsyncUnlock() unlocks server following a db.fsyncLock()</div><div class="line">	db.getCollection(cname) same as db['cname'] or db.cname</div><div class="line">	db.getCollectionInfos([filter]) - returns a list that contains the names and options of the db's collections</div><div class="line">	db.getCollectionNames()</div><div class="line">	db.getLastError() - just returns the err msg string</div><div class="line">	db.getLastErrorObj() - return full status object</div><div class="line">	db.getLogComponents()</div><div class="line">	db.getMongo() get the server connection object</div><div class="line">	db.getMongo().setSlaveOk() allow queries on a replication slave server</div><div class="line">	db.getName()</div><div class="line">	db.getPrevError()</div><div class="line">	db.getProfilingLevel() - deprecated</div><div class="line">	db.getProfilingStatus() - returns if profiling is on and slow threshold</div><div class="line">	db.getReplicationInfo()</div><div class="line">	db.getSiblingDB(name) get the db at the same server as this one</div><div class="line">	db.getWriteConcern() - returns the write concern used for any operations on this db, inherited from server object if set</div><div class="line">	db.hostInfo() get details about the server's host</div><div class="line">	db.isMaster() check replica primary status</div><div class="line">	db.killOp(opid) kills the current operation in the db</div><div class="line">	db.listCommands() lists all the db commands</div><div class="line">	db.loadServerScripts() loads all the scripts in db.system.js</div><div class="line">	db.logout()</div><div class="line">	db.printCollectionStats()</div><div class="line">	db.printReplicationInfo()</div><div class="line">	db.printShardingStatus()</div><div class="line">	db.printSlaveReplicationInfo()</div><div class="line">	db.dropUser(username)</div><div class="line">	db.repairDatabase()</div><div class="line">	db.resetError()</div><div class="line">	db.runCommand(cmdObj) run a database command.  if cmdObj is a string, turns it into &#123; cmdObj : 1 &#125;</div><div class="line">	db.serverStatus()</div><div class="line">	db.setLogLevel(level,&lt;component&gt;)</div><div class="line">	db.setProfilingLevel(level,&lt;slowms&gt;) 0=off 1=slow 2=all</div><div class="line">	db.setWriteConcern( &lt;write concern doc&gt; ) - sets the write concern for writes to the db</div><div class="line">	db.unsetWriteConcern( &lt;write concern doc&gt; ) - unsets the write concern for writes to the db</div><div class="line">	db.setVerboseShell(flag) display extra information in shell output</div><div class="line">	db.shutdownServer()</div><div class="line">	db.stats()</div><div class="line">	db.version() current version of the server</div></pre></td></tr></table></figure>
</li>
<li><p>collection 相关操作<br>假设我有个user 字段</p>
<figure class="highlight js"><table><tr><td class="code"><pre><div class="line">&gt; db.user.help()</div><div class="line">DBCollection help</div><div class="line">	db.user.find().help() - show DBCursor help</div><div class="line">	db.user.bulkWrite( operations, &lt;optional params&gt; ) - bulk execute write operations, optional parameters are: w, wtimeout, j</div><div class="line">	db.user.count( query = &#123;&#125;, &lt;optional params&gt; ) - count the number <span class="keyword">of</span> documents that matches the query, optional parameters are: limit, skip, hint, maxTimeMS</div><div class="line">	db.user.copyTo(newColl) - duplicates collection by copying all documents to newColl; no indexes are copied.</div><div class="line">	db.user.convertToCapped(maxBytes) - calls &#123;<span class="attr">convertToCapped</span>:<span class="string">'user'</span>, <span class="attr">size</span>:maxBytes&#125;&#125; command</div><div class="line">	db.user.createIndex(keypattern[,options])</div><div class="line">	db.user.createIndexes([keypatterns], &lt;options&gt;)</div><div class="line">	db.user.dataSize()</div><div class="line">	db.user.deleteOne( filter, &lt;optional params&gt; ) - <span class="keyword">delete</span> first matching <span class="built_in">document</span>, optional parameters are: w, wtimeout, j</div><div class="line">	db.user.deleteMany( filter, &lt;optional params&gt; ) - <span class="keyword">delete</span> all matching documents, optional parameters are: w, wtimeout, j</div><div class="line">	db.user.distinct( key, query, &lt;optional params&gt; ) - e.g. db.user.distinct( <span class="string">'x'</span> ), optional parameters are: maxTimeMS</div><div class="line">	db.user.drop() drop the collection</div><div class="line">	db.user.dropIndex(index) - e.g. db.user.dropIndex( <span class="string">"indexName"</span> ) or db.user.dropIndex( &#123; <span class="string">"indexKey"</span> : <span class="number">1</span> &#125; )</div><div class="line">	db.user.dropIndexes()</div><div class="line">	db.user.ensureIndex(keypattern[,options]) - DEPRECATED, use createIndex() instead</div><div class="line">	db.user.explain().help() - show explain help</div><div class="line">	db.user.reIndex()</div><div class="line">	db.user.find([query],[fields]) - query is an optional query filter. fields is optional set <span class="keyword">of</span> fields to <span class="keyword">return</span>.</div><div class="line">	db.user.find(...).count()</div><div class="line">	db.user.find(...).limit(n)</div><div class="line">	db.user.find(...).skip(n)</div><div class="line">	db.user.find(...).sort(...)</div><div class="line">	db.user.findOne([query], [fields], [options], [readConcern])</div><div class="line">	db.user.findOneAndDelete( filter, &lt;optional params&gt; ) - <span class="keyword">delete</span> first matching <span class="built_in">document</span>, optional parameters are: projection, sort, maxTimeMS</div><div class="line">	db.user.findOneAndReplace( filter, replacement, &lt;optional params&gt; ) - replace first matching <span class="built_in">document</span>, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocument</div><div class="line">	db.user.findOneAndUpdate( filter, update, &lt;optional params&gt; ) - update first matching <span class="built_in">document</span>, optional parameters are: projection, sort, maxTimeMS, upsert, returnNewDocument</div><div class="line">	db.user.getDB() get DB object associated <span class="keyword">with</span> collection</div><div class="line">	db.user.getPlanCache() get query plan cache associated <span class="keyword">with</span> collection</div><div class="line">	db.user.getIndexes()</div><div class="line">	db.user.group( &#123; <span class="attr">key</span> : ..., <span class="attr">initial</span>: ..., <span class="attr">reduce</span> : ...[, <span class="attr">cond</span>: ...] &#125; )</div><div class="line">	db.user.insert(obj)</div><div class="line">	db.user.insertOne( obj, &lt;optional params&gt; ) - insert a <span class="built_in">document</span>, optional parameters are: w, wtimeout, j</div><div class="line">	db.user.insertMany( [objects], &lt;optional params&gt; ) - insert multiple documents, optional parameters are: w, wtimeout, j</div><div class="line">	db.user.mapReduce( mapFunction , reduceFunction , &lt;optional params&gt; )</div><div class="line">	db.user.aggregate( [pipeline], &lt;optional params&gt; ) - performs an aggregation on a collection; returns a cursor</div><div class="line">	db.user.remove(query)</div><div class="line">	db.user.replaceOne( filter, replacement, &lt;optional params&gt; ) - replace the first matching <span class="built_in">document</span>, optional parameters are: upsert, w, wtimeout, j</div><div class="line">	db.user.renameCollection( newName , &lt;dropTarget&gt; ) renames the collection.</div><div class="line">	db.user.runCommand( name , &lt;options&gt; ) runs a db command <span class="keyword">with</span> the given name where the first param is the collection name</div><div class="line">	db.user.save(obj)</div><div class="line">	db.user.stats(&#123;<span class="attr">scale</span>: N, <span class="attr">indexDetails</span>: <span class="literal">true</span>/<span class="literal">false</span>, <span class="attr">indexDetailsKey</span>: &lt;index key&gt;, indexDetailsName: &lt;index name&gt;&#125;)</div><div class="line">	db.user.storageSize() - includes free space allocated to this collection</div><div class="line">	db.user.totalIndexSize() - size in bytes of all the indexes</div><div class="line">	db.user.totalSize() - storage allocated for all data and indexes</div><div class="line">	db.user.update( query, object[, upsert_bool, multi_bool] ) - instead of two flags, you can pass an object with fields: upsert, multi</div><div class="line">	db.user.updateOne( filter, update, &lt;optional params&gt; ) - update the first matching document, optional parameters are: upsert, w, wtimeout, j</div><div class="line">	db.user.updateMany( filter, update, &lt;optional params&gt; ) - update all matching documents, optional parameters are: upsert, w, wtimeout, j</div><div class="line">	db.user.validate( &lt;full&gt; ) - SLOW</div><div class="line">	db.user.getShardVersion() - only for use with sharding</div><div class="line">	db.user.getShardDistribution() - prints statistics about data distribution in the cluster</div><div class="line">	db.user.getSplitKeysForChunks( &lt;maxChunkSize&gt; ) - calculates split points over all chunks and returns splitter function</div><div class="line">	db.user.getWriteConcern() - returns the write concern used for any operations on this collection, inherited from server/db if set</div><div class="line">	db.user.setWriteConcern( &lt;write concern doc&gt; ) - sets the write concern for writes to the collection</div><div class="line">	db.user.unsetWriteConcern( &lt;write concern doc&gt; ) - unsets the write concern for writes to the collection</div><div class="line">	db.user.latencyStats() - display operation latency histograms for this collection</div></pre></td></tr></table></figure>
</li>
</ul>

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/mongo/" rel="tag"># mongo</a>
          
            <a href="/tags/install/" rel="tag"># install</a>
          
        </div>
      

      
        
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/mongodb/Index/" rel="next" title="mongoIndex">
                <i class="fa fa-chevron-left"></i> mongoIndex
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/linux/ssh/" rel="prev" title="ssh无密码登录">
                ssh无密码登录 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
      <div id="cloud-tie-wrapper" class="cloud-tie-wrapper"></div>
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="https://sfault-avatar.b0.upaiyun.com/416/326/4163260007-58a1621e63a68_huge256"
               alt="chimps" />
          <p class="site-author-name" itemprop="name">chimps</p>
           
              <p class="site-description motion-element" itemprop="description"></p>
          
        </div>
        <nav class="site-state motion-element">

          
            <div class="site-state-item site-state-posts">
              <a href="/archives">
                <span class="site-state-item-count">59</span>
                <span class="site-state-item-name">日志</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-categories">
              <a href="/categories/index.html">
                <span class="site-state-item-count">12</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            
            
            <div class="site-state-item site-state-tags">
              <a href="/tags/index.html">
                <span class="site-state-item-count">19</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
        </div>

        
        

        
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#官网"><span class="nav-number">1.</span> <span class="nav-text">官网</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#安装"><span class="nav-number">2.</span> <span class="nav-text">安装</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#启动"><span class="nav-number">3.</span> <span class="nav-text">启动</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#连接"><span class="nav-number">4.</span> <span class="nav-text">连接</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#mongo-h"><span class="nav-number">4.1.</span> <span class="nav-text">mongo -h</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#数据库操作"><span class="nav-number">5.</span> <span class="nav-text">数据库操作</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">chimps</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  








  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  


  




	





  
    
    <script>
      var cloudTieConfig = {
        url: document.location.href, 
        sourceId: "",
        productKey: "48bb30d8783d4b38ba0c95e0283238ca",
        target: "cloud-tie-wrapper"
      };
    </script>
    <script src="https://img1.ws.126.net/f2e/tie/yun/sdk/loader.js"></script>
  










  





  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  

  

  

</body>
</html>
